package router

import (
	"database/sql"
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"log"
)

// 这个文件用来处理 mysql 相关的事务
var (
	DB *sql.DB
)

func init() {
	db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@%s(%s:%s)/%s", "root", "1121331", "tcp", "localhost", "3306", "super_im"))
	if err != nil {
		log.Fatalln(err)
	}
	log.Println("connect DB success")
	DB = db
}
